<template>
  <div id="my">
    <section class="user" v-show="notLogin">
      <div class="header">
        <div>
          <img src="../assets/avatar.png" alt="" srcset="" class="header_img" />
        </div>
        <div class="login">
          <router-link to="/login" class="a"> 登录 </router-link>
        </div>
      </div>
    </section>
    <section v-show="yesLogin" class="user_profile">
      <div class="is_login">
        <div class="clear_fix">
          <div class="avatar_wrap">
            <router-link to="">
              <img
                src="../assets/avatar.png"
                alt=""
                srcset=""
                class="header_img"
              />
            </router-link>
          </div>
          <div class="info_wrap">
            <h3>
              <span>{{ this.iphone }}</span>
              <span>Lv.1</span>
            </h3>
          </div>
        </div>
        <div class="vip">
          <div class="vip_wrap">
            <a href="#">
              <p>0</p>
              <p>aha值返利</p>
            </a>
            <a href="#">
              <p>0</p>
              <p>我的优惠券</p>
            </a>
            <a href="#">
              <p>0</p>
              <p>我的积分</p>
            </a>
            <a href="#">
              <p>0</p>
              <p>超值权益</p>
            </a>
          </div>
        </div>
      </div>
    </section>
    <section class="orders">
      <p>我的订单</p>
      <router-link to="">待付款</router-link>
      <router-link to="">待发货</router-link>
      <router-link to="">待收货</router-link>
      <router-link to="">我的订单</router-link>
    </section>
    <section>
      <div class="banner-aha">
        <router-link to="">
          <img src="../assets/bg_not_aha.png" alt="" />
        </router-link>
        <div class="info">
          <h3>
            <span>诺心aha会员</span>
            <span>尊享更多惊喜礼遇</span>
          </h3>
          <h3>立即开通</h3>
        </div>
      </div>
    </section>
    <section class="service">
      <p class="section_title">我的服务</p>
      <router-link to="">生日助手</router-link>
      <router-link to="">个人资料</router-link>
      <router-link to="">储值卡<br />专享兑换券</router-link>
      <router-link to="">在线客服</router-link>
      <router-link to="">我的发票</router-link>
      <router-link to="">关于我们</router-link>
    </section>
  </div>
</template>

<script>
export default {
  name: "My",
  data() {
    return {
      token: "admin",
      notLogin: true,
      yesLogin: false,
      iphone: null,
    };
  },
  methods: {
    afterRead(file) {},
  },
  created() {
    if (localStorage.getItem("token")) {
      if (localStorage.getItem("token") == this.token) {
        this.notLogin = false;
        this.yesLogin = true;
      } else {
        this.notLogin = true;
        this.yesLogin = false;
      }
    }
    if (localStorage.getItem("iPhone")) {
      this.iphone = JSON.parse(localStorage.getItem("iPhone"));
    }
  },
};
</script>

<style scoped="scoped">
#my {
  width: 100%;
  height: 13.34rem;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #3e3e3e;
  font-size: 0.28rem;
}
.user {
  margin: 0;
  border-radius: 0;
}
section {
  margin: 0.2rem 0.4rem;
  background: #ffffff;
  border-radius: 5px;
}
.header {
  text-align: center;
  padding: 0.3rem 0.24rem 0.2rem;
}
.header_img {
  width: 1.1rem;
  height: 1.1rem;
}
.login {
  padding: 0.2rem 0 0.24rem;
}
.login .a {
  width: 1.2rem;
  height: 0.48rem;
  line-height: 0.48rem;
  margin: 0 auto;
  border-radius: 2px;
  background: #a38d6b;
  color: #ffffff;
  text-align: center;
  text-decoration: none;
  display: block;
  font-size: 0.24rem;
}
.orders p {
  padding: 0.2rem;
  font-size: 0.24rem;
  border-bottom: 1px solid #f9f9f9;
}
.orders a {
  width: 25%;
  height: 0.5rem;
  position: relative;
  padding-top: 0.8rem;
  text-align: center;
  margin: 0.2rem 0;
  float: left;
  font-size: 0.1rem;
  color: #3e3e3e;
}
.orders a::before {
  content: "";
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  background: url("../assets/icons.png") no-repeat center;
  background-size: 5rem 5rem;
  top: 15%;
  margin-top: -0.2rem;
  background-position: -0.22rem -0.2rem;
  left: 55%;
  margin-left: -0.4rem;
}
.orders a:nth-of-type(2)::before {
  background-position: -1.2rem -0.2rem;
}
.orders a:nth-of-type(3)::before {
  background-position: -2.2rem -0.2rem;
}
.orders a:nth-of-type(4)::before {
  background-position: -3.2rem -0.2rem;
}
.orders::after {
  content: " ";
  clear: both;
  display: block;
  height: 0;
  line-height: 0;
  visibility: hidden;
}
.banner-aha {
  width: 100%;
  cursor: pointer;
  margin-top: 0.3rem;
  position: relative;
}
.banner-aha a {
  display: block;
  position: relative;
}
.banner-aha a img {
  width: 100%;
  vertical-align: top;
}
.info {
  width: 65%;
  position: absolute;
  left: 47%;
  margin-left: -26%;
  top: 20%;
  transform: translateY(-50%);
  color: #ffffff;
}
.info h3:nth-of-type(1) span:nth-of-type(1) {
  font-size: 0.26rem;
}
.info h3:nth-of-type(1) span:nth-of-type(2) {
  font-size: 0.1rem;
}
.info h3:nth-of-type(1) span {
  display: block;
}
h3 {
  margin: 0;
  font-weight: normal;
  font-size: inherit;
}
.info h3:nth-of-type(2) {
  font-size: 0.1rem;
  position: absolute;
  right: 0;
  top: 40%;
  transform: translateY(-50%);
}
.section_title {
  padding: 0.2rem;
  font-size: 0.12rem;
  border-bottom: 1px solid #f9f9f9;
}
.service a {
  float: left;
  width: 25%;
  height: 0.5rem;
  position: relative;
  padding-top: 0.8rem;
  text-align: center;
  margin: 0.2rem 0;
  font-size: 0.1rem;
  color: #3e3e3e;
}
.service a::before {
  content: "";
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  background: url("../assets/icons.png") no-repeat center;
  background-size: 5rem 5rem;
  top: 15%;
  margin-top: -0.2rem;
  left: 55%;
  margin-left: -0.4rem;
}
.service a:nth-of-type(1)::before {
  background-position: -4.2rem -0.2rem;
}
.service a:nth-of-type(2)::before {
  background-position: -2.2rem -2.2rem;
}
.service a:nth-of-type(3)::before {
  background-position: -0.2rem -1.2rem;
}
.service a:nth-of-type(4)::before {
  background-position: -3.2rem -1.2rem;
}
.service a:nth-of-type(5)::before {
  background-position: -4.2rem -1.2rem;
}
.service a:nth-of-type(6)::before {
  background-position: -1.2rem -2.2rem;
}
.service::after {
  content: " ";
  clear: both;
  display: block;
  height: 0;
  line-height: 0;
  visibility: hidden;
}
.user_profile {
  margin: 0;
  border-radius: 0;
}
.is_login {
  padding: 0.6rem 0.4rem 0.48rem;
  position: relative;
  background: url("../assets/bg_customer.png") repeat-y top center;
  background-size: 100% auto;
}
.clear_fix::after {
  content: " ";
  clear: both;
  display: block;
  height: 0;
  line-height: 0;
  visibility: hidden;
}
.avatar_wrap {
  float: left;
}
.info_wrap {
  position: relative;
  width: 75%;
  height: 0.55rem;
  float: left;
  margin-left: 0.24rem;
}
.info_wrap > h3 {
  position: absolute;
  top: 70%;
}
.info_wrap > h3 span:nth-of-type(1) {
  font-size: 0.22rem;
  font-weight: bold;
}
.info_wrap > h3 span:nth-of-type(2) {
  padding: 0.02rem 0.08rem;
  margin-left: 0.2rem;
  line-height: normal;
  font-size: 0.18rem;
  color: #ffffff;
  background: #a38d6b;
  border-radius: 2px;
}
.vip {
  margin-top: 0.4rem;
}
.vip_wrap {
  display: flex;
}
.vip_wrap > a {
  color: #3e3e3e;
  text-decoration: none;
  position: relative;
  display: block;
  text-align: center;
  width: 25%;
}
.vip_wrap > a::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0.2rem;
  border-left: .02rem solid #e0dcd1;
}
.vip_wrap > a:nth-of-type(4):after{
  content: "";
  height: 0;
}
.vip_wrap > a p {
  margin: 0;
}
.vip_wrap > a p:nth-of-type(1) {
  font-weight: bold;
}
.vip_wrap > a p:nth-of-type(2) {
  font-size: 0.22rem;
}
</style>